<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="onein" uri="http://www.onein.cn/jsp/taglib"%>
<%@ page import="cn.onein.edu.web.common.base.BaseController" %>
<%@ page import="cn.onein.edu.biz.bean.User" %>
<%
final String selectedMenuStr = "class=\"selected\"";
String index = "";
String learn = "";
String register = "";
String loginPage = "";
String lostPass = "";
String activeNewEmail = "";
String centerSelectedStyle = ""; //用户中心
String promotionDaily = ""; // 精选指南
String userinfo = "";
String memberService = "";
String shareAction = "";
String payment = "";
String team = "";
String terms = "";
String memberterms = "";
String help = "";
String about = "";
String contacts = "";
String feedback = "";


String menuValue = (String)request.getAttribute(BaseController.MENU_KEY);

if(BaseController.MENU_VALUE_INDEX.equals(menuValue)){
	index = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_LEARN.equals(menuValue)){
	learn = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_REGISTER.equals(menuValue)){
	register = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_LOGIN.equals(menuValue)){
	loginPage = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_LOST_PASSWORD.equals(menuValue)){
    lostPass = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_ACTIVE_NEW_EMAIL.equals(menuValue)){
    activeNewEmail = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_PERSON_CENTER.equals(menuValue)){
	centerSelectedStyle = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_DAILY.equals(menuValue)){
	promotionDaily = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_USER_INFO.equals(menuValue)){
    userinfo = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_MEMBER_SERVICE.equals(menuValue)){
	memberService = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_SHARE_ACTION.equals(menuValue)){
	shareAction = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_PAYMENT.equals(menuValue)){
	payment = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_EDU_TEAM.equals(menuValue)){
    team = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_TERMS.equals(menuValue)){
	terms = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_MEMBER_TERMS.equals(menuValue)){
	memberterms = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_HELP.equals(menuValue)){
    help = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_ABOUT.equals(menuValue)){
    about = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_CONTACT.equals(menuValue)){
    contacts = selectedMenuStr;
}
else if(BaseController.MENU_VALUE_FEEDBACK.equals(menuValue)){
    feedback = selectedMenuStr;
}
else{
	//default
	index = selectedMenuStr;
}

String dispName = "";
boolean isLogin = false;
// 用户中心长标题style
String langBgLiStyle = "";
// 用户中心的名字
String centerName = "宝宝的每一天";

if(request.getSession(false) != null){
	User user = (User)request.getSession(false).getAttribute(BaseController.SESSION_USER_KEY);
	if(user != null){
		isLogin = true;		
		boolean haveNickName = false;
		if(user.getNickName() != null && user.getNickName().length() > 0){			
			dispName = user.getNickName();
			centerName = user.getNickName() + "每一天";
			haveNickName = true;
		}
		else if(user.getName() != null){
			dispName = user.getName();
		}
		else{
			dispName = user.getEmail();
		}
		
		if(user.getParentSexValue() != null){
            if(haveNickName == true){
            	if(user.getParentSexValue() == true){
            		dispName = dispName + "的爹哋";
            	}
            	else{
            		dispName = dispName + "的妈咪";
            	}
            }
            else{
            	if(user.getParentSexValue() == true){
                    dispName = "宝宝的爹哋";
                }
                else{
                    dispName = "宝宝的妈咪";
                }
            }
        }
		else if(haveNickName == true){
            dispName = dispName + "的家人";
        }
		
		if(centerName.length() > 4){
            langBgLiStyle = "style=\"width:130px;\"";
            if(centerSelectedStyle.length() > 0){
                centerSelectedStyle = "class=\"langSelected\"";
            }
        }
	}
}
%>
<div id="navWrap">
   	<ul>
       <li><span><a href="<onein:url value="/"/>" <%=index %>>首页</a></span></li>       
       <%if(payment.length() > 0){ %>
        <li><span><a href="#" <%=payment %>>支付服务</a></span></li>
       <%} else if(shareAction.length() > 0){ %>
        <li><span><a href='<onein:url value="/"/>' <%=shareAction %>>好友分享</a></span></li>
       <%} else if(loginPage.length() > 0){ %>
        <li><span><a href='<onein:url value="/login"/>' <%=loginPage %>>用户登陆</a></span></li>
       <%} else if(register.length() > 0){ %>
        <li><span><a href='<onein:url value="/register"/>' <%=register %>>用户注册</a></span></li>
       <%} else if(lostPass.length() > 0){ %>
        <li><span><a href='#' <%=lostPass %>>找回密码</a></span></li>
       <%} else if(activeNewEmail.length() > 0){ %>
        <li><span><a href='#' <%=activeNewEmail %>>激活邮箱</a></span></li>
       <%} %>
       
       <%if(isLogin){ %>
        <li <%=langBgLiStyle %>><span><a href='<onein:url value="/center"/>' <%=centerSelectedStyle %>><%=centerName %></a></span></li>
        <li><span><a href='<onein:url value="/center/userinfo"/>' <%=userinfo %>>个人资料</a></span></li>
        <li><span><a href='<onein:url value="/center/memberService"/>' <%=memberService %>>会员服务</a></span></li>
       <%}else{ %>
        <li><span><a href='<onein:url value="/promotion"/>' <%=promotionDaily %>>精选指南</a></span></li>
       <%} %>
       
       <li><span><a href='<onein:url value="/learn"/>' <%=learn %>>育儿百科</a></span></li>       
       
       <%if(terms.length() > 0){ %>
        <li><span><a href="<onein:url value="/terms"/>" <%=terms %>>服务条款</a></span></li>
       <%} else if(help.length() > 0){ %>
        <li><span><a href="<onein:url value="/help"/>" <%=help %>>帮助中心</a></span></li>
       <%} else if(about.length() > 0){ %>
        <li><span><a href="<onein:url value="/about"/>" <%=about %>>关于万应</a></span></li>
       <%} else if(feedback.length() > 0){ %>
        <li><span><a href="<onein:url value="/feedback"/>" <%=feedback %>>意见反馈</a></span></li>
       <%} else if(memberterms.length() > 0){ %>
        <li><span><a href="<onein:url value="/member-terms"/>" <%=memberterms %>>会员条款</a></span></li>
       <%} else if(contacts.length() > 0){ %>
        <li><span><a href="<onein:url value="/contacts"/>" <%=contacts %>>联系我们</a></span></li>
       <%} %>
       
       <%if(isLogin == false){ %>
        <li><span><a href="<onein:url value="/team"/>" <%=team %>>专家团队</a></span></li>
       <%} %>
       
    </ul>
    <%if(isLogin){ %>
    <div class="menuLoginInfo">
        <span class="userLoginInfo">欢迎<%=dispName %>&nbsp;</span>
        <a href="<onein:url value="/logout"/>" class="botton1"><span>注  销</span></a>
    </div>
    <%}else{%>
    <div class="menuLoginInfo">
       <a href="<onein:url value="/login"/>" class="botton1"><span>登  陆</span></a>
       <a href="<onein:url value="/register"/>" class="botton1 ml11"><span>注  册</span></a>
    </div>
    <%}%>
</div>